using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using QLKS.DataLayer.BusinessObjects;
using QLKS.DataLayer.Base;

namespace QLKS.DataLayer.ManagerObjects
{
    public partial interface ILoaiPhongManager : IManagerBase<LoaiPhong, int>
    {
		// Get Methods
		LoaiPhong GetByTenLoaiPhong(System.String tenLoaiPhong);
    }

    partial class LoaiPhongManager : ManagerBase<LoaiPhong, int>, ILoaiPhongManager
    {
		#region Constructors
		
		public LoaiPhongManager() : base()
        {
        }
        public LoaiPhongManager(INHibernateSession session) : base(session)
        {
        }
		
		#endregion
		
        #region Get Methods

		
		public LoaiPhong GetByTenLoaiPhong(System.String tenLoaiPhong)
        {
            ICriteria criteria = Session.GetISession().CreateCriteria(typeof(LoaiPhong));
			
			
			criteria.Add(NHibernate.Criterion.Expression.Eq("TenLoaiPhong", tenLoaiPhong));
			
			IList<LoaiPhong> result = criteria.List<LoaiPhong>();
			return (result.Count > 0) ? result[0] : null;
        }
		
		#endregion
    }
}